function p = least_square_new(dis,n)
%最小二乘（新）
%输入四个距离,n组，输出位置
p=zeros(n,3);
x_off=0;
y_off=0;
z_off=0;
%1\2\3对应的是0、1、3
x1=x_off-0.66;
y1=y_off+0.52;
z1=z_off;
x2=x_off+0.4;
y2=y_off+0.52;
z2=z_off+0.5;
x3=x_off+0.4;
y3=y_off-0.54;
z3=z_off;
for i=1:n
    d1=dis(i,1);
    d2=dis(i,2);
    d3=dis(i,3);
    A=[1,-2*x1,-2*y1,-2*z1;
       1,-2*x2,-2*y2,-2*z2;
       1,-2*x3,-2*y3,-2*z3]; 
    B=[d1^2-x1^2-y1^2-z1^2;
       d2^2-x2^2-y2^2-z2^2;
       d3^2-x3^2-y3^2-z3^2];
    X=(A'*A)^(-1)*A'*B;
    xx=X(2);
    yy=X(3);
    zz=X(4);
%     zz=sqrt(abs(zz2));
    p(i,:)=[xx,yy,zz];
end
end

